<?
global $db;

include_once(DIR_MODEL."md_cat_san_pham.class.php");
$objcatSanpham = new MD_CatSanpham($db);
$arrayData_catSanpham =  array();    
$parent_id  = CM_getParameter("parent_id");
$arrayData_catSanpham = $objcatSanpham->getByWhere("*","parent_id = ".$parent_id." AND hien_thi = 1","thu_tu asc");
if(!empty($arrayData_catSanpham)){
?>

<div class="bg_l_t">
	<div class="bg_r_t">
		<div class="bg_c_t">
		</div>
	</div>
</div><!-- bg_l_t -->

<table cellpadding="0" cellspacing="0" width="100%" class="khung_home" border="0">
<?
$count = 0;
$totalArrayData = count($arrayData_catSanpham);
foreach($arrayData_catSanpham as $rowCat){
if($count == 0){
?>
	<tr>
<?
}
?>
		<td width="35%" >
			<img src="../images/icon_submenu.gif" border="0" style="float:left; padding-left:10px; padding-top:2px; ">
			<span style="padding-left:10px; ">
			<a href="?modul=sanpham&action=List&id_loai_sp=<?=$rowCat['id']?>&parent_id=<?=$rowCat['parent_id']?>" 
				style="font-weight:bold; color:#000; text-decoration:none; ">
			<?=$rowCat['ten_loai_sp']?>
			</a>
			</span>
		</td>
<?
	$count ++;
	$totalArrayData --;
	if(($count == 1) && ($totalArrayData == 0)){
?>
		<td width="35%">&nbsp;</td>
		<td width="35%">&nbsp;</td>
<?
	}//end if(($count == 1) && ($totalArrayData == 0))
	if(($count == 2) && ($totalArrayData == 0)){
?>
		<td width="35%">&nbsp;</td>
<?
	}// end if(($count == 2) && ($totalArrayData == 0))
	if($count > 2){
		$count = 0;
	
?>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
<?
	}//end if($count > 2)
}//end foreach
?>
</table>

<div style="clear:both"></div>
<div class="bg_l_b">
	<div class="bg_r_b">
		<div class="bg_c_b">
		</div>
	</div>
</div><!-- bg_l_b -->
<br>
<?
}
?>
